<template>
  <div>
    <BasicTable @register="registerTable"></BasicTable>
    <Drawer @register="registerDrawer" @success="handleSuccess" />
  </div>
</template>
<script lang="ts" setup name="userScanEmployee">
import { BasicTable } from '@apps/antd-admin/src/components/Table';
import { useDrawer } from '@apps/antd-admin/src/components/drawer';
import { useBaseTable } from '@apps/antd-admin/src/hooks';

import { columns } from './data/data';
import { Api } from './data/api';

const [registerDrawer, { openDrawer }] = useDrawer();
const { prefixCls, tableContext, handleDelete, handleSuccess, handlePost, handleBatchDelete } = useBaseTable({
  designScope: 'userScanEmployee-template',
  tableProps: {
    //表格标题
    title: '扫码列表',
    //主键字段
    rowKey: 'openEmployeeId',
    //列表接口
    listUrl: Api.page,
    handlerName: 'appUserScanEmployeeListHandler',
    //列定义
    columns,
    showActionColumn: false,
  },
});
const [registerTable, { setProps, reload }, { rowSelection, hasSelectedRows }] = tableContext;

function setSearchInfoProps(userId) {
  console.info('userId', userId);
  setProps({ searchInfo: { userId: userId } });
}

defineExpose({
  setSearchInfoProps,
});
</script>
